using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;

namespace GameEditor.Common
{
    public partial class DockableWindow : DockContent
    {
        public DockableWindow()
        {
            InitializeComponent(); base.DockAreas = DockAreas.DockBottom | DockAreas.DockTop | DockAreas.DockRight | DockAreas.DockLeft | DockAreas.Float;
        }

        public string UniqueName
        {
            get
            {
                return GetPersistString();
            }
        }
        protected virtual void ProcessCmdKey_SendToActiveView(ref Message msg, Keys keyData)
        {
            GameEditor.Common.IApplicationEnvironment env = Global<GameEditor.Common.IApplicationEnvironment>.Instance;
            if (env.ActiveView != null)
            {
                Win32SDK.User32.SendMessage(env.ActiveView.Handle, Win32SDK.Constants.WM_KEYDOWN, msg.WParam, (IntPtr)msg.LParam);
                Win32SDK.User32.SendMessage(env.ActiveView.Handle, Win32SDK.Constants.WM_CHAR, msg.WParam, (IntPtr)msg.LParam);
                Win32SDK.User32.SendMessage(env.ActiveView.Handle, Win32SDK.Constants.WM_KEYUP, msg.WParam, (IntPtr)msg.LParam);
            }
        }
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            ProcessCmdKey_SendToActiveView(ref msg, keyData);
            return base.ProcessCmdKey(ref msg, keyData);
        }
    }
}